
package com.justspeak;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

/**
 * 欢迎界面。
 */
public class SplashActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splashview);
        loadData();
    }

    /**
     * 用于加载数据及检查其他进入程序条件，目前是强制等待2s
     */
    private void loadData() {
        new Thread(new Runnable() {
            public void run() {
                long begin = System.currentTimeMillis();
                try {

                    long loadingTime = System.currentTimeMillis() - begin;
                    if (loadingTime / 2000 < 1) {
                        Thread.sleep(2000);
                    }
                    SplashActivity.this.startActivity(new Intent(SplashActivity.this,
                            LoginActivity.class));
                    SplashActivity.this.finish();
                } catch (Exception e) {
                    SplashActivity.this.finish();
                }
            }
        }).start();
    }
}
